import qs from "qs";
import http from "@/api";
import { pa } from "element-plus/es/locale";
//获取分类
export const getClassification = () => {
  return http.post("/pages/event!getCategoryTreeAllData.action?flag=dataDic&num=50&types=Request&parentEventId=0");
};
//验证分类是否已存在
export const isExist = params => {
  return http.post("/pages/event!isCategoryExisted.action", qs.stringify(params));
};
//编辑分类
export const editClass = params => {
  return http.post("/pages/event!update.action", qs.stringify(params));
};
//删除分类
export const deleteClass = params => {
  return http.post("/pages/event!remove.action", qs.stringify(params));
};
//新增分类
export const addClass = params => {
  return http.post("/pages/event!save.action", qs.stringify(params));
};
//获取问题分类
export const getQuestionClass = params => {
  return http.post("/pages/event!getCategoryTreeAllData.action?flag=dataDic&num=50", qs.stringify(params));
};
//编辑前验证
export const checkClass_edit = params => {
  return http.post("/pages/event!isCategoryExistdOnEdit.action", qs.stringify(params));
};
//提交编辑
export const editClass_submit = params => {
  return http.post("/pages/event!update.action", qs.stringify(params));
};
//添加前验证
export const checkClass_add = params => {
  return http.post("/pages/event!isCategoryExisted.action", qs.stringify(params));
};
//提交新增
export const addClass_submit = params => {
  return http.post("/pages/event!save.action", qs.stringify(params));
};
//删除
export const deleteProblemClass = params => {
  return http.post("/pages/event!remove.action", qs.stringify(params));
};
//获取变更分类
export const getChangeClass = params => {
  return http.post("/pages/event!getCategoryTreeAllData.action?flag=dataDic&num=50", qs.stringify(params));
};
//编辑变更分类验证
export const checkChangeClass_edit = params => {
  return http.post("/pages/event!isCategoryExistdOnEdit.action", qs.stringify(params));
};
//提交编辑变更分类
export const editChangeClass_submit = params => {
  return http.post("/pages/event!update.action", qs.stringify(params));
};
//新增变更分类验证
export const checkChangeClass_add = params => {
  return http.post("/pages/event!isCategoryExisted.action", qs.stringify(params));
};
//提交新增变更分类
export const addChangeClass_submit = params => {
  return http.post("/pages/event!save.action", qs.stringify(params));
};
//删除变更分类
export const deleteChangeClass = params => {
  return http.post("/pages/event!remove.action", qs.stringify(params));
};
//获取资产分类
export const getCimClass = () => {
  return http.post("/pages/ciCategory!getConfigurationCategoryTreeAllData.action?_=1721111822508&parentEventId=0");
};
//获取自定义类型
export const getEavEntity = params => {
  return http.post("/pages/eav!findEavEntity.action", qs.stringify(params));
};
//验证编辑资产是否存在
export const isExist_cim = params => {
  return http.post("/pages/ciCategory!isCategoryExistdOnEdit.action", qs.stringify(params));
};
//更新资产分类
export const updateCim = params => {
  return http.post("/pages/ciCategory!update.action", qs.stringify(params));
};
//验证增加资产分类
export const isExist_cim_add = params => {
  return http.post("/pages/ciCategory!isCategoryExisted.action", qs.stringify(params));
};
//增加资产分类
export const addCim = params => {
  return http.post("/pages/ciCategory!save.action", qs.stringify(params));
};
//删除资产分类
export const removeCim = params => {
  return http.post("/pages/ciCategory!remove.action", qs.stringify(params));
};
//获取服务目录列表
export const getServiceCatalog = params => {
  return http.post("/pages/event!getCategoryTreeAllData.action?flag=dataDic&num=50", qs.stringify(params));
};
//获取自定义表单
export const getCustomField = () => {
  return http.post("/pages/formCustom!findAllRequestFormCustom.action");
};
//提交编辑服务目录验证
export const checkServiceCatalog = params => {
  return http.post("/pages/event!isCategoryExistdOnEdit.action", qs.stringify(params));
};
//提交编辑服务目录
export const editServiceCatalog = params => {
  return http.post("/pages/event!update.action", qs.stringify(params));
};
//提交添加服务目录前验证
export const checkServiceCatalog_add = params => {
  return http.post("/pages/event!isCategoryExisted.action", qs.stringify(params));
};
//提交添加服务目录
export const addServiceCatalog = params => {
  return http.post("/pages/event!save.action", qs.stringify(params));
};
//删除服务目录
export const deleteServiceCatalog = params => {
  return http.post("/pages/event!remove.action", qs.stringify(params));
};
//获取规则包列表
export const getRulePackage = params => {
  console.log(params);
  return http.post(
    "/pages/rulePackage!findRulePackageByPage.action",
    qs.stringify({
      page: params.pageNum,
      rows: params.pageSize,
      sidx: "rulePackageNo",
      sord: "desc",
      "rulePackageDto.packageName": params["rulePackageDto.packageName"],
      "rulePackageDto.flagName": params["rulePackageDto.flagName"],
      "rulePackageDto.rulePackageRemarks": params["rulePackageDto.rulePackageRemarks"],
      "rulePackageDto.module": params["rulePackageDto.module"]
    })
  );
};
//规则包新增前验证是否存在
export const checkRulePackage_add = params => {
  return http.post("/pages/rulePackage!findRulePackageBoolean.action", qs.stringify(params));
};
//新增规则包
export const addRulePackage = params => {
  return http.post("/pages/rulePackage!saveRulePackage.action", qs.stringify(params));
};
//编辑规则包
export const editRulePackage = params => {
  return http.post("/pages/rulePackage!editRulePackage.action", qs.stringify(params));
};
//删除规则包
export const deleteRulePackage = params => {
  return http.post("/pages/rulePackage!deleteRulePackage.action", params);
};
//请求规则
//获取规则列表
export const getRuleList = params => {
  return http.post(
    "/pages/callBusinessRule!findRules.action?flagName=requestProce,saveRequest",
    qs.stringify({
      page: params.pageNum,
      rows: params.pageSize,
      sidx: "ruleNo",
      sord: "desc",
      "ruleQueryDTO.description": params["ruleQueryDTO.description"],
      "ruleQueryDTO.ruleName": params["ruleQueryDTO.ruleName"]
    })
  );
};
//获取sla列表
export const getSLAList = params => {
  return http.post(
    "/pages/slaContractManage!find.action?" + params,
    qs.stringify({
      page: params.pageNum,
      rows: params.pageSize,
      sidx: "contractNo",
      sord: "desc"
    })
  );
};
//获取位置列表
export const getLocationList = () => {
  return http.post("/pages/event!getCategoryTreeAllData.action?flag=dataDic&num=50&types=Location&parentEventId=0");
};
//获取知识库分类列表
export const getKnowledgeCategoryTree = () => {
  return http.post("/pages/event!getCategoryTreeAllData.action?flag=dataDic&num=50&types=Knowledge&parentEventId=0");
};
